#ifndef __font_h__
#define __font_h__


#define CH_SUSPENSION_POINTS ('\202')

typedef int HDFont;

typedef struct tag_rect
{
    int x, y, width, height;
}rect_t, *prect_t;

#ifndef BITx
#define BITx(_val, _x) (_val & (0x00000001<<_x))
#endif

#define HDFontInvalidVal (0)

#define ALIGN_LEFT (1<<0)
#define ALIGN_MID (1<<1)
#define ALIGN_RIGHT (1<<2)
#define ALIGN_TOP (1<<3)
#define ALIGN_YMID (1<<4)
#define ALIGN_BOTTOM (1<<5)
#define CALC_TEXT_SIZE (1<<31)

typedef struct tag_font_proc
{
    int font_width, font_height;
    HDFont (*CreateFont)(void);
    void (*GetTextSize)(HDFont hf, const char *str, int *x, int *y);
    void (*GetBitMaps)(HDFont hf, int ch, void **bitmaps, int *width, int *height);
    void (*DrawText)(HDFont hf, const char *str, short x, short y, void (*SetPixel)(short, short));
    void (*SetTextSize)(HDFont hf, int size);
    void (*DestroyFont)(HDFont hf);
    void *Priv;
    const char *FontName;
}font_proc_t, *pfont_proc_t;

/**font*/
extern "C" HDFont ascii_5x8, ascii_8x14, ascii_15x25, ascii_10x21;


extern "C" HDFont create_font(const char *name);
extern "C" void draw_text(HDFont hf, const char *str, prect_t prc, int flags);
extern "C" void draw_text_with_return(HDFont hf, char *str_dis, prect_t prc);
extern "C" void set_font_size(HDFont hf, int size);
extern "C" void destroy_font(HDFont hf);
extern "C" void GUI_CreateAllFont(void);

#endif

